project(
  plugin_test
  LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOUIC_SEARCH_PATHS (ui))
find_package(Qt5 COMPONENTS Widgets Core REQUIRED)

set(_srcs
    src/qls_plugin_test.cpp
    src/qls_plugin_test_service.cpp
)

set(_headers
    include/plugin_test/qls_plugin_test.h
    include/plugin_test/qls_plugin_test_service.h
)

set(_ui
    ui/qls_plugin_test.ui
)

add_library(plugin_test SHARED ${_srcs} ${_headers} ${_ui})
target_link_libraries(plugin_test PUBLIC
    themes_manager log
    plugins_manager_appfwk
    Qt5::Widgets Qt5::Core
)
target_include_directories(plugin_test PRIVATE include)

file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH}/plugins/QCoreSystem/)

add_custom_command(
    TARGET ${PROJECT_NAME} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E create_symlink
    ${LIBRARY_OUTPUT_PATH}/lib${PROJECT_NAME}.so ${LIBRARY_OUTPUT_PATH}/plugins/QCoreSystem/lib${PROJECT_NAME}.so
)
